perm filename IMPRES.RAS[UP,DOC]1 blob sn#638572 filedate 1982-01-31 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00017 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	Intro to ImPress file formats and language
C00009 00003	File Format	- Final Format
C00013 00004			- Memory allocation, the job header
C00018 00005			- Intermediate Format - STOP, it's changing
C00022 00006			- 	       Postamble
C00029 00007	Impress language
C00032 00008			- Marks
C00034 00009			- orientation commands
C00036 00010			- glyph definitions
C00041 00011			- size of a glyph
C00044 00012			- glyph deletions
C00048 00013			- typesetting commands
C00054 00014			- more typesetting commands
C00058 00015			- remarks
C00060 00016			- command summary
C00063 00017	Pointers
C00068 ENDMK
CāŠ—;
Intro to ImPress file formats and language

---------
This is a new document.  Please send criticisms to RAS@Sail.  
					Jan 14, 1982 -ras
---------

The ImPress language is a document description language made for use  with
ImPrint printers.   An  ImPress  file  contains  a  set  of  pictures  and
instructions telling where  to print  them on  a page.   The pictures  are
bitmaps and all printing coordinates are in pixel units making an  ImPress
file device  dependent,  ie,  the  size of  a  printed  page  produced  is
dependent upon the printer resolution.

ImPrint printers  buffer an  entire  page before  printing,  necessitating
compact descriptions and careful  space management.  The ImPress  language
is designed  to efficiently  describe a  page of  text and,  perhaps  less
efficiently, any printed page.  In addition, the data on a page should  be
ordered to aid the ImPrint in processing the page.

A page given to an ImPrint must  be a complete description in the  special
ImPress language.   To  aid an  ImPrint  in utilizing  space  well,  glyph
descriptions should appear before  typesetting information.  To make  best
use of time  and space,  the incoming page  should use  glyphs defined  on
previous pages, if  necessary, telling  the ImPrint to  delete old  glyphs
that are not needed.

To aid in the creation of ImPress files, there are currently two types  of
ImPress file  formats,  Intermediate  and Final.   Final  format  is  true
ImPress, complete and well ordered.  Intermediate form consists of ImPress
commands  plus  a   postamble.   An  Intermediate   format  file  may   be
inefficiently organized and may lack  glyph descriptions.  It is the  role
of a  finishing  program  to  reorder  an  Intermediate  file,  add  space
allocation commands and add any missing  glyphs so that the file is  ready
for spooling.

Having two  forms  of ImPress  files  lessens  the workload  of  the  many
programs that produce them.  To  produce a complete, well ordered  ImPress
file, either two passes must be made  over a page, or both glyph data  and
typesetting commands must be buffered.   Only after these sizes are  known
can space allocation  commands, which must  appear at the  beginning of  a
page, be determined.

The finishing  program  will  do  this second  pass.   It  will  read  the
postamble at the end of the  Intermediate ImPress file and then  reprocess
the pages.  It is best if a finishing program is able to do random  access
file reading so that the document may be spooled in reverse order, leaving
the first page on top as it emerges from the ImPrint.

The space allocation necessary for a  document is dependent on the  amount
of space available in  an individual ImPrint-10, the  order the pages  are
printed and which pages are printed  at all.  Thus, the finishing  program
is best incorporated into a spooler.

ImPrint-10s handle Final format  files best.  However, Intermediate  files
can be printed.  They will be correct to the extent that needed glyphs are
defined and  its glyphs  can  be stored  in  the ImPrint  without  special
allocation instructions.

File Format	- Final Format

An ImPress file is composed of 8-bit bytes.  In the following descriptions
of both the Final and Intermediate formats, the following conventions  are
used.

Characters are 7-bit ascii values stored in the low order bits of a  byte.
Below, literal strings of characters  are surrounded by double quotes,  ie
"Imag" is a string of four characters.  Numbers are values of bytes.  Thus
`0 2' means a null byte is followed by a byte containing the value two.

The ImPress language consists of 256 commands.  Some of them are  followed
by parameter bytes.  Words  preceded by an exclamation  mark `!' refer  to
specific ImPress commands.  Words describing sections are surrounded by by
pointy brackets, eg  `<description>'.  The part  describing an  individual
page is surrounded by square brackets, `[]'.  The asterisk following means
any number of sets of page descriptions may be listed here.

Final format files have extension "IMF"

Final Format:  
The file begins with 16 bytes identifying the file type.  The last four of
these is the ascii representation of the format's version number.  This is
the first version.  Next comes the title string, ending with a null  byte.
The next byte is an ascii character # such that #-"0" is the number of  8k
segments to be allocated  for typesetting data.  (See  next page for  more
information).  The capacity of the ImPrint  minus this space is then  used
for glyph data.   Note: currently,  the ImPrint  at Sail  has 55295  bytes
available for input and glyphs.

Each page  begins  with delete  commands,  followed by  glyph  definitions
followed by the typesetting data  delimited by Page and EndPage  commands.
After the final page is finished, an EndFile command is given.  Note  that
strings never contain a zero byte, an ascii NUL.

    # <title string> 0

    [<delete commands, if any>
     <glyph definitions, if any>
     !Page <typesetting data> !EndPage
     ]*

    !EndFile


		- Memory allocation, the job header

A final format file contains one ImPress job ready to be printed on an
ImPrint.  This consists of two fields followed by the ImPress commands.
The header has the form:
	<Memory Allocation Parameter> <Job Identification>


Memory Allocation Parameter:	1 byte.

The first byte of  a job can be  used to adjust the  relative size of  the
Input Area and the Glyph Table, in order to make the printing process more
efficient.

When the first input byte is the Ascii  code of a number between 1 and  5,
it defines the size  (in 8K byte  modules) of the  Input Area, which  thus
varies from 8K to 40K bytes; the rest of the available memory is  assigned
to the Glyph Table.

As a general  rule, a  bigger Input  Area will  usually make  the job  run
faster.  Giving more  input space  allosw more of  a page  to be  buffered
while the previous ones are being processed and printed, thus  eliminating
delay due  to transmission.   The maximum  Input Area  is defined  by  the
minimum size required for the Glyph Table.


Job Identification: 	A string terminated by a null byte.

This string identifies the job.


MEMORY ALLOCATION IN THE GLYPH AREA:

When a job starts,  the glyph area  is empty. Every  new glyph defined  in
imPRESS will  be added  to the  glyph area.  Every glyph  mentioned in  an
imPRESS delete command will be marked for deletion.

When the  glyph area  is  full and  a new  glyph  is defined,  the  system
proceeds to delete all the marked  glyphs, and relocate the remaining ones
in a compact  manner (there is  no fragmentation in  the glyph area).   If
after this process there is still not enough space for the new glyph,  the
glyph definition and any references to the glyph are ignored.


MEMORY ALLOCATION IN THE INPUT AREA:
Every imPRESS defined page is divided in two parts:
The "pre-page" part: any  series of commands that  appear before the  page
    start command, and
the "post-page" part: the  series of commands that  appear after the  page
    start command.

During the printing of a job, the pre-page part is deallocated as soon  as
each command is executed, while the post-page part remains throughout  the
printing of a page.

[From an efficiency standpoint, it is  convenient to define new glyphs  in
the pre-page part so that as soon they are included in the glyph area, the
corresponding memory in the input area will be released, thus allowing for
better buffering of the input]


ABSOLUTE MEMORY REQUIREMENTS:
Glyph Area: must be large enough to hold all glyphs needed on any page,
    whatever does not fit will be ignored.

Input Area: must be big enough to hold:
    the longest command (eg, a large glyph definition) in all pre-page parts
    and the biggest entire post-page part of any page in the job.

    [Again it is convenient to use the pre-page part to define glyphs]

		- Intermediate Format - STOP, it's changing

[!!! much may change, take 5 1/31/82 -ras !!!]

Intermediate format files have extensions "IM"

[!!!!!  not yet certain !!!!! header may change...]

Intermediate Format:  This format is very similar to the Final Format;  it
is designed  to be  very  compatible.  The  differences are  the  possible
exclusion of the delete commands and glyph definitions and the possibility
of finding glyph definitions intermixed with typesetting data.  After  the
!EndFile command comes the Postamble.  Note that the postamble is one long
string.  If an Intermediate  ImPress file is sent  to an ImPrint, it  will
think the  Postamble  is  a new  file  with  a long  name,  no  space  for
typesetting data and no pages!  A detailed description of the Postamble is
on the next page.  Note again that  strings never contain a zero byte,  an
ascii NUL.
(Note: currently, files currently should begin with #<name><null byte>)

    "ImagImPr"
    "Intr0001"
    <title string> 0 #

    [<delete commands, to be ignored by a finisher>
     <glyph definitions, if any; will used by a finisher>
     !Page <typesetting data with possible glyph definitions intermixed>
     !EndPage
     ]*

    !EndFile

    "PostAmble"
    <parameter delimiter char: non alphanumeric, eg ":"> 
    <substring delimiter char: non alphanumeric, eg "@"> 
    "Rep:"  <"ascii" or "byte">  ":" # "@"
    "File:" <source file string> "@"  
    "Date:" <source date string> "@"

    "Margins:" <left margin> ":" <right margin> ":" 
	       <top margin> ":" <bottom margin> "@" 
    "Paper:" <"standard" or "legal"> "@" 
    ["Font:" # ":" <name> ":" <size> ":" <mag*1000> ":" 
		   <host> ":" <dir if at host> "@"      ]*
    ["P:" <abs byte addr> ":" <pageno>]* 

    "EndPostAmble: < # bytes in pstamble> @" 

    0 0 

    !EndFile


(see next page for explanation of format)
		- 	       Postamble
[!!! much may change, take 5 1/31/82 -ras !!!]

The Postamble is  an ascii string  composed of substrings,  each of  which
begins with a keyword and ends  with a break character.  The beginning  of
the postamble is marked  by the literal  "Postamble".  The two  characters
following this are taken to be the break characters.  The first  separates
keywords from  their parameters;  the second  separates substrings.   They
must be two distinct, non alphanumeric characters.  In the examples below,
these characters  are ":"  and "@",  respectively.  Characters  should  be
chosen that do not appear in used file names.

Next come informational substrings.  Their order is not important.   Below
is a list of  these fields.  They  begin with a keyword  and end with  the
second break character.  Note that all fields are ascii strings.   Numbers
are strings of ascii decimal digits.

Rep : type : #
    The way the  data in the  file is represented.   `type' is "ascii"  or
"byte".  # is a numeric  string telling the number of  bits to be read  as
one byte or one ascii char.  For a standard file, this is `byte:8', for an
ascii file at Sail, it is `ascii:7'; for an ascii file on Shasta, it would
be `ascii:8'. The  type field  must be  filled.  If  the #  field is  left
blank, the default size for the machine is used, thus allowing text  files
to be sent to other sites using programs that do automatic conversion.

File : name	
    The name of the original source,  used for title page any string  that
does not include a break character

Date : month : day : year
    The date the ImPress file was made

Margins	: left : right : top : bottom
    Absolute pixel values for the positions of the four margins.

Paper : type
    This tells the spooler  on what type of  paper to print the  document,
either "standard" (8.5x11 inches) or  "legal" (8x14 inches).  Other  types
will be added as capabilities are expanded.

Font : # : name : size : mag : host : dir
In the typesetting data,  fonts are accessed by  their font number.   This
command associates a number with a font name.  The font name consists of a
generic name, eg "CMR",,  the design size, eg  "10" point, and the  font's
magnification times 1000, eg 2.0 goes to 2000.  At Sail this would be made
into a  file  name "CMR10.r20".   Last  are possible  directory  and  host
strings where the font may  be found.  This allows  fonts to be used  that
are in private directories

P: address : pageno
    One of these commands  must appear for every  page to be printed.   It
gives the page  number and byte  address of  a page.  The  address is  the
absolute byte address of the first command for this page.
    Pageno is the page number of the page, allowing the finishing  program
to output a subset  of the pages.  To  allow pages with multiple  numbers,
<pageno> may have several fields, eg, `12:4:2'.  The leftmost numbers  are
more significant, unlisted  fields on the  right are assumed  to be  zero.
This allows having a many chaptered  document in an intermediate file  and
being able to print chapters individually.  A finisher may implement  this
as desired.

EndPostAmble : #
    This marks the end of the postamble.  It is followed by a byte pointer
which tells  the length  of  the PostAmble  from the  beginning  PostAmble
command all  the way  through  the last  !EndFile  command.  Thus  if  the
EndPostAmble field has a  number 200 following it  and is located at  byte
1300, then the PostAmble begins at byte 1119 (`"EndPostAmble:200" 00 !End'
has length 19).  So if the !EndFile mark is at position P, and the  length
of the postamble is given as L, there should be another postamble mark  at
P-L followed by the "PostAmble" string.

So an intermediate file  for a 3  page manual just  printed on January  6,
1982, assuming the file is in standard eight bit bytes, with 16k allocated 
for typesetting data might look like this:

    "ImagImPrIntr0001Manual.tex" 0 2
    !Page <data> !EndPage
    !Page <data> !EndPage
    !Page <data> !EndPage
    !EndFile
    "PostAmble:@Rep:Byte:8@File:Manual@Date:1:6:82@"
    "Margins:130:1982:262:2330@Paper:standard@"
    "Font:1:cmr:10:1000:Sail:[can,sys]@"
    "Pages:33:281:1067@EndPostAmble:159" 0 0 !EndFile

Impress language

The Impress language is made up of commands.  Currently there are two ways
to express these commands,  as binary values and  as ascii strings.   This
document only describes the binary representation.

For efficiency, the ImPress language is limited to 256 commands,  allowing
each command in  the binary  representation to fit  into one  8 bit  byte.
Some commands are followed  by parameters, many  are not.  Parameters  are
one or two bytes long,  with the exception of a  glyph bit map, which  has
variable length.  In the descriptions that follow, a parameter preceded by
"<" takes up a single byte; one preceded by "<<" takes up two bytes.

There are five types of commands:
Marks, Orientation, Glyph Definition, Glyph Deletion, Typesetting.

The Marks delimit pages,  separate the two sections  within each page  and
mark the end  of the File,  or job.  Orientation  commands allow  printing
naturally in any  rotation.  Glyph and  character definitions provide  the
pictures of symbols that are printed on each page.  The deletion  commands
delete old pictures of symbols that are no longer needed, freeing up  room
for other symbols.  The bulk of commands are Typesetting commands, telling
where to print the defined glyphs.




Note: in the following  pages, commands that are  not yet implemented  are
      surrounded by parentheses.

		- Marks

Marks	[Page, EndPage, EndFile]

In the beginning of an InPress file there is an ascii string, followed  by
a null byte.  The rest  of the file is sequence  of pages.  Each page  has
two parts, the  prepage and  the on-page sections.   The prepage  section
contains all  glyph  and  font  definition  and  deletion  commands.   The
on-page section contains the typesetting  data, the description of  where
objects should be placed  on the page.   (Note: Intermediate format  files
may have glyph and font definitions in the on-page section too).

!Page    = 213;
!EndPage = 219;
The prepage  section  begins at  the  end of  the  previous page,  or  the
beginning of  a job.   Only  definition and  deletion commands  are  legal
there.  The !Page command ends the  prepage section and begin the  on-page
section.  The on-page section,  and thus the current  page, ends with  the
!EndPage command.

!EndFile = 255	
The !EndFile command  comes after  the last page's  !EndPage command.   In
Final format files, this is at the very end of the file.  In  Intermediate
format files, the one  after the last page's  !EndPage is followed by  the
Postamble string which is followed by two null bytes and another !EndFile.


		- orientation commands

The default orientation for ImPrints is portrait mode, the width of a page
is smaller than the height.  Several commands are available to print in 
other rotations, but they are not yet implemented, so little discussion is
included. 

The are two orientations, main and secondary.  (I believe...) Main is the
direction in which characters are printed (normally rightward).  Secondary
is the direction subsequent lines are printed.  Thus normal text in portrait
mode has main and secondary directions respectively rightward and downward.
Printing in landscape mode requires directions upward and rightward.

(
!PagOr  = 204  <rot;
    set the page orientation- global command, once in a file at beginning?
!MS     = 205  <rot-coord
    set the main & secondary rotations
!RotMS  = 206  <rot
    set the main & secondary rotations;
)
		- glyph definitions

Glyph Definition	[Small and Big Glyph, Define-Font commands]
In the following, "character" will refer to any printable symbol,  "glyph"
will mean one static picture that can be stored in a bit map.  An  ImPrint
prints a character  in a certain  rotation.  If a  character is needed  in
three different rotations, the ImPrint  will make three glyphs, and  three
bit maps, of  the character.  In  general, we deal  with glyphs, since  we
send bit maps  in ImPress files.   Later on, when  all of the  orientation
commands are implemented,  it  may  be common  to define  both glyphs  and
characters.

Glyphs are named by  their font number, their  character number and  their
rotation.  In typesetting them, you must specify the number of the current
font and the character number of  the symbol to be printed.  The  rotation
is determined by the current printing orientation.

!SGly   = 198	<<font-char  <adv  <wid  <x  <ht  <y {mask};
!BGly   = 199   <<font-char <<adv <<wid <<x <<ht <<y {mask};
These two commands are used to define  glyphs as bit maps.  The "S" &  "B"
stand for small and big.  If all of the five (adv, w, x, h, y)  parameters
have values small enough  to be stored  in a single  byte, then the  !SGly
command should be used, otherwise, the !BGly command.

The font-char field is actually three fields combined into two bytes.  The
first (high, left)  two bits  are used  for the  rotation.  For  unrotated
characters, the rotation is zero.  [!!FIND OUT CONVENTION FOR LATER!!]

The next seven  bits contain the  font number; the  low, right seven  bits
contain the character number.   Untill this glyph  is deleted, these  font
and character numbers will be used to access this glyph.

Adv is the  advance width (printing  or nominal width)  of the  character.
After the character is set at a  position, the current x position will  be
advanced by Adv (assuming the character is unrotated).

The next 4 parameters refer to the bit map.  Ht and Wid are the height and
the width of the bit map in pixels.   X (resp Y) is the distance from  the
top (resp left) of the bit map  to the reference point.  If the  reference
point is inside the bit map, X and Y are positive.  The bitmap consists of
Ht*((Wid+7)%8) bytes, Ht rows, each row  containing a row of the  picture,
left justified in an integral number of bytes.  The bit map and the values
are the same as are in Rst files (see Rst.ras[up,doc]).  Note that X and Y
are signed integers, Adv is non-negative and Ht and Wid are positive.   No
character with an empty bitmap should be sent to an ImPrint.

(
There will someday be fonts inside each ImPrint.  To use these, a font
number must be associated with a resident font.  The following command
does this.  

!font   = 203  	<font> <type> {name in 8 bytes};
After giving this definition, any character in the font may be typeset.
?Does a user have to keep track of space of glyphs made from this?  
?A widths file format must be defined- Rst w/o bitmaps?
?Define <type>
)

		- size of a glyph

Size of a Glyph in ImPrint Memory
The following procedure returns the number of bytes the ImPrint will require
to store a character.  Comments begin with`!' and end with `;'.

integer procedure CharSpace
(integer f, c, 	    ! font and char numbers;
	 ht, biw,   ! bitmap height (scan lines) and bit width;
	 byw,       ! number of bytes in bit map width (biw+7)%8;
	 pw,        ! advance width in pixels, printing width;
	 x, y);     ! upper left corner offsets from ref point (pixels);
    begin
    if (ht*biw)=0 then begin
	error("Empty Glyphs should not be sent to the ImPrint!");
	return(0) end
    else begin integer i;
	 i← ! the amount of space needed is the sum of 4 things;

	    ! either 12 or 16 bytes of data for the char definition
	    !       depending on whether the char is large or small;
	    (if ((pw lor biw lor abs(2*x) lor ht lor abs(2*y)) < 256) 
		then 12 else 16) +

	    ! the bitmap requires (Ht lines times # of bytes per line) bytes;
	    ht*byw + 	

	    ! ImPrint puts bitmap in 16 bit words, add Ht bytes if byw is odd;
	    (if odd(byw) then ht else 0) +

	    ! ImPrint puts thin chars in an even # of scan lines;
	    (if byw>2 then 0 else 
		(if odd(ht) then byw else 0));

	 return(i)
	 end;
    end;

		- glyph deletions

Glyph Deletion	[Delete-char command (also delete-glyph) and delete-font]

All the glyph bitmaps you need for a page must be in ImPrint memory before
the page is printed.  To print the next page, you may need to load some additional
glyphs, but if they'll fit into memory, there is no need to delete any old ones.
If they don't fit into memory, you can delete old glyphs with the delete 
character command.

!DelC   = 201	<<font-char;
Note that the two pieces of information, the font and character numbers, each
a 7-bit quantity, should be in the bottom (low, right) 14 bits of the two
byte parameter.  This command will delete all bitmaps (there may be up to
four, pertaining to four different rotations) of the character.

(
Is there ever any time a user would give a delete glyph command?
!DelG   = 200   <<rot-font-char;
How does a user program know what rotations are around without keeping track
    of every change of orientation, etc?
Does a user have to keep track of space required by resident fonts?
)

!DFnt   = 202    <font>;
This command deletes all of the characters used that belong to the given
font number.  (I never use this command...)


Glyph deletions are needed only if the additional glyphs to be defined on
the page would overflow ImPrint memory.  Glyphs are stored in the ImPrint
in contiguous space.  Deletion involves erasing the unnecessary glyphs 
and then packing those remaining.

One deletion scheme used is  that if a deletion  is needed, all glyphs  in
the ImPrint that are not needed on the current page are deleted.  This  is
an easy scheme to  implement and frees  as much space  as possible in  the
ImPrint so fewer pages  will require deletion.  On  the other hand,  extra
space may be freed  and glyphs deleted  which will be  needed on the  next
page, requiring those  characters to  be redefined,  taking up  additional
communication time.

Another approach is to delete only as many glyphs as are needed to free up
needed space.  The problem with this  is that after the deletions and  new
definitions, memory will again be full.  The next page will again  require
deletions if even  one new glyph  is defined.  On  the other hand,  memory
holds as many glyphs as  it can, requiring fewer  to have to be  redefined
later.

Knowledge of the document would make an efficient caching scheme feasible,
but this does  not seem to  be worth  the effort.  The  first approach  is
probably best for most uses.


		- typesetting commands

Typesetting  a  document  consists  of  positioning  glyphs  at  different
locations on  page.   In  general,  you need  just  three  commands,  move
horizontally, move vertically and set  a glyph.  To make typesetting  more
natural and efficient, thirteen commands are provided and 6 global  values
are used.

There is always a location known as the current location, or the  position
of an imaginary cursor.   Ten commands move the  cursor and typesetting  a
glyph or a rule (a black rectangle, eg a line segment) consists of  moving
the cursor to the proper postition and  giving a command to set the  glyph
or rule.

The first two global variables are the current X and Y positions (the  top
left of  the paper  is position  (0,0), positive  is downward  and to  the
right, in normal orientation).  When a page is begun, the current position
is preset to (0,0).

!H      = 195: horizontal change <<x>>;
!V      = 196: vertical change <<y>>;
The !H command, followed by a two byte signed integer, sets the current  X
coordinate.  The integer parameter should be  shifted one bit to the  left
to free the lowest (rightmost) bit for a flag.  If the right bit is 0 then
the current X coord is set to the parameter's value.  If the bit is 1  the
parameter is a relative change;  the current X coord  is set to its  value
plus the parameter's.  The !V command is analgous for the vertical, or  Y,
coordinate.

!BSkip  = 208: set baseline skip to <<bskip>>;
!Marg   = 209: set margin to <<margin>>;
!NL     = 197: newline, go to next line at left margin;
The next  three global  variables  are the  current  left margin  and  the
current baselineskip.   In typesetting  text,  it is  most common  to  set
characters next to  each other  until the line  is finished.   A new  line
usually starts at  some left  margin a  fixed distance  below the  current
line.  The !BSkip command lets you set the distance between baselines; the
!Marg command  lets you  set  the current  left  margin; the  !NL  command
advances Y to Y + BSkip, and sets X to Marg.

!MP 	 = 131: change x by plus 1;
!MM	 = 132: change x by minus 1;
!Mov	 = 130: change x by <x> <I!mov-repeated>;
In Rst  font files,  all  characters have  an advance-width,  or  printing
width.  After a character is typeset at a location, a following  character
is usually set on the  same baseline at the  same location plus the  first
character's advance width.  Whole words can usually be typeset in  ImPress
with no move commands after the first character is set.  In case  rounding
errors acumulate,  two  special commands  increment  and decrement  the  x
coordinate, resp the !MP and !MM (move plus, move minus) commands.

It is more efficient for ImPress  to contain lots of small movements  than
lots  of  large  ones.   For  other  horizontal  movements  in  the  range
[-128,127] the !Mov command  is more efficient than  the !H command.   The
!Mov command is unique in  that it has the form  "!Mov # !Mov".  It  takes
three bytes, like  the !H command,  but it  is easier for  the ImPrint  to
handle.

!SetSp  = 210: set space width <<s>>;
!Space  = 128: advance x by space width;
!1Spac	= 129: advance x by space+1;
Usually a line of text has  constant width spacing between words.   Taking
advantage of this is a Space variable.  The width is set using the  !SetSp
command.  To  increment  by  Space  or Space+1,  there  are  two  commands
provided, !Space and !1Spac.
		- more typesetting commands

The "environment" is composed of 6 values, the current:  X and Y position,
baseline-skip, left-margin, space-width  and font.   ImPress provides  two
commands, Push and !Pop to let you  push the environment onto, and pop  it
from, a global  stack allowing  you to  easily return  to one  environment
after making some local changes.

!Push   = 211: push the environment onto a stack;
!Pop    = 212: pop an environment from the stack;

Current versions of ImPrint have a nesting  level of about 10, so you  can
not push too  far.  Also, pushing  leaves its mark  on the ImPrint's  data
structure, using them too often may result in inefficient or  unmanageable
code.  For instance, DVI  to ImPress programs should  not echo DVI  pushes
with ImPress pushes.  We  have had problems with  TEX generated DVI  files
both  overflowing  the  stack  level  and  overworking  an  ImPrint   with
unnecessary pushes.


Setting Glyphs

!F	 = 207 <font number>;
set-glyph= 0..127;
A global variable CurFont holds the current font number.  At the beginning
of each page, this is initialized to  zero.  To set a glyph, if  CurFont's
value is not of the font you desire, set CurFont with the !F command.  All
of the commands so far have had values greater than 127.  This leaves  all
of the numbers in [0,127] to be used as glyph setting commands.  To set  a
glyph, simply give the glyph's character number.  The ImPrint combines the
current font number  and the glyph  command number to  choose the  correct
glyph from those defined.

Setting Rules

!SRule  = 192  <ht  <wid  <voff;
!BRule  = 193 <<ht <<wid <<voff;
A rule  is  a  black  rectangle  of any  positive  height  and  width.   A
horizontal line is a rule with a large width and small height.  A vertical
rule has a small width and large height.  The VOff parameter is a vertical
offset, the distance from the top left corner of the rule to the current Y
coordinate.  Ht and Wid are unsigned  bytes, VOff is signed.  VOff is  the
top-left corner  position  minus the  current  Y coordinate  and  thus  is
positive if the entire rule is below the current printing line.  Thus most
lines of text and rules can be typeset from a common baseline.


 
		- remarks

In the preceding pages, 28+128 commands and corresponding values have been
defined.  There is plenty of room for addition of new commands to  enhance
the language.   Graphic  object commands  are  among those  planned.   New
commmands will be announced as their design is completed.

In addition, ImPress allows new commands to be defined and all commands to
have their command values reassigned.   More detailed information on  this
subject has yet to come from Imagen.

When a new page is begun, the current location is set to (0,0).  Also, the
environment stack is cleared  even if there were  fewer pops than  pushes.
The rest  of the  variables: font,  left-margin, baseline-skip  and  space
width are preserved.  Note that  the current values are preserved,  rather
than what they would be if the stack was cleared by popping.

		- command summary

command   octal decimal    meaning &
mnemonic  value  value    parameters
-----------------------------------------
!Space	= '200; ! 128: advance x by space width;
!1Spac	= '201; ! 129: advance x by space+1;

!Mov	= '202; ! 130: change x by <x <I!mov-repeated;
!MP 	= '203; ! 131: change x by plus 1;
!MM	= '204; ! 132: change x by minus 1;

!SRule	= '300; ! 192: small rule <ht <wid <voff;
!BRule	= '301; ! 193:  big rule  <<ht <<wid <voff;

!H	= '303; ! 195: horizontal change <<x-rel;
!V	= '304; ! 196: vertical change <<y-rel;
!NL	= '305; ! 197: newline, go to next line at left margin;

!SGly	= '306; ! 198: define a small glyph 
				<<font-char <nw <w <x <h <y{mask};
!BGly	= '307; ! 199: define a big glyph 
				<<font-char <<adv <<wid <<x <<ht <<y {mask};
!Delg	= '310; ! 200: delete glyph <<rot-font-char;
!Delc	= '311; ! 201: delete char <<font-char;

!DFont	= '312; ! 202: deletes all glyphs of a font and the fontid <font;
!Font	= '313; ! 203:  	font <font<type{name in 8 bytes};

!Pagor	= '314; ! 204: set the page orientation <rot;
!MS	= '315; ! 205: set the main & secondary rotations  <rot-coord;
!RotMS	= '316; ! 206: set the main & secondary rotations <rot;

!F	= '317; ! 207: set cur font to <f;
 
!BSkip	= '320; ! 208: set baseline skip to <<bskip;
!Marg	= '321; ! 209: set margin to <<margin;
!SetSp	= '322; ! 210: set space width <<s;

!Push	= '323; ! 211: push the environment onto a stack;
!Pop	= '324; ! 212: pop an environment from the stack;

!Page	= '325; ! 213: output the page;
!EndPage= '333; ! 219: end page;

!EndFile= '377; ! 255;

Pointers

Documentation  on  how  to  use  Canon,  the  ImPrint-10  at  Sail  is  in
Canon.ras[up,doc].  It describes the physical  printer and how to use  all
software needed to print TEX files and listings.

Information about Rst font files is in Rst.ras[up,doc].

A brief description of  the Imagen Communication  Protocol subset used  at
Sail is in ImProt.doc[can,sys].

Please send questions and comments to RAS@Sail.